<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
</head>
<!-- 使用第三方的动画效果库 地址：https://animate.style/  -->
<style>
      .box {
        height: 100px;
        width: 200px;
        background-color:aquamarine;
    }

    /* 入场动画类 */
    .s1 {
        opacity: 0;
    }

    .s2, .s3 {
        transition: all 2s ease-in;
    }

    /* 离场动画类 */
    .s4 {
        opacity: 1;
    }

    .s5 {
        opacity: 0;
    }
</style>
<body>
    <div id="app"></div>
</body>
<script src="js/vue.js"></script>
<script>
    const app = Vue.createApp({
        data() {
            return {
                msg: "animation 库动画",
                isShow: false,

            }
        },
        template: `
            <div>
                <transition>
                    <div class="box animate__animated animate__bounce" v-show="isShow">{{msg}}  box1 </div>
                </transition>
               <br>
                <transition 
                    enter-from-class="s1"
                    enter-active-class="s2"
                    enter-to-class="s4"
                    leave-from-class=""
                    leave-active-class="s2"
                    leave-to-class="s5"
                    >
                    <div class="box" v-show="isShow">{{msg}} box2</div>
                </transition>

                <br>

                <transition 
                   enter-active-class="animate__animated animate__bounce"
                   leave-active-class="animate__animated animate__wobble"
                   :duration="{enter: 3000, leave: 2000}">
                    <div class="box" v-show="isShow">{{msg}} box3</div>
                </transition>

                <button @click="isShow = !isShow">显示与隐藏</button>    
            </div>
        `

    }).mount("#app");
</script>

</html>
